package com.itheima.jsoup;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import java.io.File;
import java.net.URL;
/*
Jsoup对象功能

 */

public class Test02 {
    public static void main(String[] args) throws Exception {
        //获取student.xml的路径
        String path = Test01.class.getClassLoader().getResource("student.xml").getPath();
        //解析xml文档
        /*org.jsoup.nodes.Document document = Jsoup.parse(new File(path), "utf-8");
        System.out.println(document);
  */

       /* Document document = Jsoup.parse("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
                "\n" +
                "<students>\n" +
                "\t<student number=\"heima_0001\">\n" +
                "\t\t<name id=\"itcast\">\n" +
                "\t\t\t<xing>张</xing>\n" +
                "\t\t\t<ming>三</ming>\n" +
                "\t\t</name>\n" +
                "\t\t<age>18</age>\n" +
                "\t\t<sex>male</sex>\n" +
                "\t</student>\n" +
                "\t<student number=\"heima_0002\">\n" +
                "\t\t<name>jack</name>\n" +
                "\t\t<age>18</age>\n" +
                "\t\t<sex>female</sex>\n" +
                "\t</student>\n" +
                "\n" +
                "</students>");
        System.out.println(document);*/

        URL url=new URL("https://www.baidu.com/s?ie=UTF-8&wd=%E7%99%BE%E5%BA%A6");
        Document document = Jsoup.parse(url, 10000);
        System.out.println(document);

    }
}
